Conversation
Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
…erties page Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
…lexMeasures/flexmeasures into feat/allow-update-of-parentasset-on-ui
… the same name of the asset itself Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
nhoening
left a comment
There was a problem hiding this comment.
I tested it and it works nicely!
- One thing missing is a check server-side (which I stated in the issue).
- The server-side code which processes the form should check if the parent asset really belongs to the same account.
- Also make sure the asset is not listed as its own parent asset (this can be later extended to check for circularity, the parent asset should not be in the list of children or their descendants - needs a small recursive function).
- Also, do not include the asset itself in the list of options given to the template.
Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
In the backend, I'm only sending assets in the same account, so the user doesn't even have the option to select a foreign asset
This also doesn't happen anymore
Isn't this the same as the above |
The backend needs to do its own checks and not trust the client. |
Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
This is now implemented How about the other things I replied to? Are we on the same page with that? |
This is vague. Which things? I checked and I'm not sure what open reply I should look up. |
this part
|
If you say so :) I'll take a look in the review.
I believe you are correct in this! |
nhoening
left a comment
There was a problem hiding this comment.
Okay, thanks!
I approve, but if you could be so kind, add a comment and a docstring like I indicated, and I will merge this :)
| if parent_asset_id is not None: | ||
| parent_asset = db.session.get(GenericAsset, parent_asset_id) | ||
| if not parent_asset: | ||
| if parent_asset_id is None: |
There was a problem hiding this comment.
You added a second condition, so a short docstring would be nice:
"""
If a parent_asset_id is set, the parent asset should
- exist
- be in the same account of the context asset (if that is known via schema.context["asset"])
"""
| tags: | ||
| - Assets | ||
| """ | ||
| asset_data = request.get_json() |
There was a problem hiding this comment.
Just add a comment: "validating the path data ourselves, as we want to add context information (current asset).
There was a problem hiding this comment.
Ok sure, I can do that, I should be home in a few hours
|
Oh, also you did not add a changelog entry yet @joshuaunity - please add these 3 things. |
Signed-off-by: Joshua Edward <oghenerobojosh01@gmail.com>

Description
In this PR, I added a new field to the asset UI edit form, allowing users to update an asset's parent asset.
Look & Feel
Before

After

How to test
propertiespageFurther Improvements
In the future, it would be more powerful if we refactored these forms to use JavaScript for their update and other controls
Related Items
This PR closes #1441
Sign-off